/*
 *  添加用户界面
 */
var util = require('../../utils/util.js');
var app = getApp();
Page({
  data: {
    moeny: "待支付",
    ynumber: "",
  },
  onLoad: function (option) {
    var that = this;
    var phone = app.owner.phone;
    wx.request({
      url: 'https://wwl.ycws.cc/ssm/owner/newselectPhone',
      data: {
        yphone: phone
      },
      header: {
        'content-type': 'application/json'
      },
      success: function (res) {
        console.log("---------"+res.data);
        if (res.data.newowner == null) {
          wx.request({
            url: 'https://wwl.ycws.cc/ssm/owner/selectOnePhone',
            data: {
              yphone: phone
            },
            header: {
              'content-type': 'application/json'
            },
            success: function (res) {
              console.log(res.data)
              console.log(res.data.uploadfiles[0].ynumber)
              app.owner.ynumber = res.data.uploadfiles[0].ynumber;
              wx.redirectTo({
                url: '../../pages/adduser/adduser'
              })
            }
          })
        } else {
          that.setData({ list: res.data.newowner.uploadfiles });
          console.log(res.data);
          app.ynumber=res.data.newowner.ynumber;
          app.owner.ynumber=res.data.newowner.ynumber;
        }
      },
      fail: function (res) {
        console.log("没有数据");
      }
    })
  },
  shenghe:function(){
    util.msg("提示","请前往管理处审核");
  },
  update:function(){
    wx.redirectTo({
      url: '../showuser/showuser'
    })
  },
  exit: function () {
    util.indexk("提示", "确定退出吗？");
  }

})